import { Directive } from 'vue';

interface ElType extends HTMLElement {
    __handleInput__: (event: Event) => any;
}
const download: Directive = (el: ElType, binding) => {
    const value = (binding.value as string | undefined) ?? el.innerText; // 如果不传入指令参数则使用文字显示信息

    const Base_Url = import.meta.env.VITE_IMG_BASE_URL;
    el.addEventListener('click', () => {
        window.open(`${Base_Url}${value}`, '_blank');
    });
};

export default download;
